/*
 * @Author: Bo Cai
 * @Mail: caibo0520@qq.com
 * @Date: 2021-10-08 00:23:36
 * @LastEditors: Bo Cai
 * @LastEditTime: 2021-12-03 23:24:28
 */
import request from '@/utils/request'
const api_name = '/edu-service/chapter'

export default {
    data() {
        return {
            dialogChapterFormVisible: false, //是否显示章节表单
            chapter: {// 章节对象
                title: '',
                sort: 0
            }
        }
    },
    getNestedTreeList(courseId) {
        return request({
            url: `${api_name}/nested-list/${courseId}`,
            method: 'get'
        })
    },
    removeById(id) {
        return request({
            url: `${api_name}/${id}`,
            method: 'delete'
        })
    },
    save(chapter) {
        return request({
            url: api_name,
            method: 'post',
            data: chapter
        })
    },
    getById(id) {
        return request({
            url: `${api_name}/${id}`,
            method: 'get'
        })
    },
    updateById(chapter) {
        return request({
            url: `${api_name}/${chapter.id}`,
            method: 'put',
            data: chapter
        })
    },
}